#ifndef NOZZLEINSPECTDOCKWIDGET_H
#define NOZZLEINSPECTDOCKWIDGET_H
#include <QtCore/QSettings>
#include <QtWidgets/QVBoxLayout>
#include <QtWidgets/QDockWidget>
#include <QtWidgets/QComboBox>
#include <QtWidgets/QPushButton>
#include <QtWidgets/QSpinBox>
#include "StageView.h"
#include "NozzleHolder.h"

class NozzleInspectDockWidget : public QDockWidget
{
    Q_OBJECT
public:
    NozzleInspectDockWidget(QWidget *parent = Q_NULLPTR, Qt::WindowFlags flags = Qt::WindowFlags());
    ~NozzleInspectDockWidget();
    void loadSettings(QSettings &settings);
    void setPosition(double x_mm, double y_mm);
    void getPosition(int row, int col, double &x_mm, double &y_mm) {m_holder.getPosition(row, col, x_mm, y_mm);}
    void getColRow(double x_mm, double y_mm, int &row, int &col) {m_holder.getColRow(x_mm, y_mm, row, col);}
signals:
    void saveImage();
    void saveImageWithMark();
    void nozzleZero();
    void batchMeasure();
    void showFileNameDialog();
    void gotoPositon(double x_mm, double y_mm, double speed);
    void innerCircleMeasure();
private slots:
    void setNozzleZeroPos();
    void gotoRowCol();
private:
    void initContent();
    void initConnection();

    NozzleHolder m_holder;

    QWidget * dockWidget;
    QVBoxLayout * verticalLayout;
    QHBoxLayout * horizontalLayout;
    QHBoxLayout * horizontalLayoutGoto;
    QHBoxLayout * horizontalLayout_2;
    QHBoxLayout * horizontalLayout_3;
    QComboBox * comboBoxNozzle;
    QPushButton * pushButtonNozzleMeasure;
    QPushButton * pushButtonNozzleZero;
    QPushButton * pushButtonBatchMeasure;
    QPushButton * pushButtonShowFileNameDialog;
    QPushButton * pushButtonSaveWithMark;
    QPushButton * pushButtonSaveWithoutMark;
    QSpinBox * spinBoxGotoRow;
    QSpinBox * spinBoxGotoCol;
    QPushButton * pushButtonGotoRowCol;
    StageView * m_stageView;

    double m_currentX;
    double m_currentY;
};

#endif // NOZZLEINSPECTDOCKWIDGET_H
